//网络请求
import axios from 'axios';
import AppConfig from '@/constants/AppConfig.js';

const $axios = axios;

export default function() {
	var $app_config = AppConfig();
	var $base_url = $app_config.Base_Url;
	var $post_config = $app_config.POST_Cfg;

	// 获取注册用户总数量
	var $url_get_total_count_2_user = $base_url + "/admin/static/v1/getTotalCount2User";
	// 获取周增长用户数量
	var $url_get_week_count_2_user = $base_url + "/admin/static/v1/getWeekCount2User";
	// 获取入库影片数量
	var $url_get_total_count_2_work = $base_url + "/admin/static/v1/getTotalCount2Works";
	// 获取属性标签数量
	var $url_get_total_count_2_Atag = $base_url + "/admin/static/v1/getTotalCount2Atag";
	// 获取实体标签数量
	var $url_get_total_count_2_Etag = $base_url + "/admin/static/v1/getTotalCount2Etag";
	
	return {
		getTotalCount2User: function() {
			return new Promise(function(resolve, reject) {
				$axios.post($url_get_total_count_2_user, {}, $post_config)
					.then(function(response) {
						console.log(response);
						resolve(response);
					})
					.catch(function(err) {
						reject(err);
					});
			});
		},
		getWeekCount2User: function() {
			return new Promise(function(resolve, reject) {
				$axios.post($url_get_week_count_2_user, {}, $post_config)
					.then(function(response) {
						console.log(response);
						resolve(response);
					})
					.catch(function(err) {
						reject(err);
					});
			});
		},
		getTotalCount2Works: function() {
			return new Promise(function(resolve, reject) {
				$axios.post($url_get_total_count_2_work, {}, $post_config)
					.then(function(response) {
						console.log(response);
						resolve(response);
					})
					.catch(function(err) {
						reject(err);
					});
			});
		},
		getTotalCount2Atag: function() {
			return new Promise(function(resolve, reject) {
				$axios.post($url_get_total_count_2_Atag, {}, $post_config)
					.then(function(response) {
						console.log(response);
						resolve(response);
					})
					.catch(function(err) {
						reject(err);
					});
			});
		},
		getTotalCount2Etag: function() {
			return new Promise(function(resolve, reject) {
				$axios.post($url_get_total_count_2_Etag, {}, $post_config)
					.then(function(response) {
						console.log(response);
						resolve(response);
					})
					.catch(function(err) {
						reject(err);
					});
			});
		}
	}
}